package com.sdslzyxyhtgl.modules.zy.controller;

import java.util.Arrays;
import java.util.Map;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.sdslzyxyhtgl.modules.zy.entity.DepartmentdynamicsEntity;
import com.sdslzyxyhtgl.modules.zy.service.DepartmentdynamicsService;
import com.sdslzyxyhtgl.common.utils.PageUtils;
import com.sdslzyxyhtgl.common.utils.R;



/**
 * 
 *
 * @author wujunfeng
 * @email 2223098767@qq.com
 * @date 2022-05-12 09:49:46
 */
@RestController
@RequestMapping("zy/departmentdynamics")
public class DepartmentdynamicsController {
    @Autowired
    private DepartmentdynamicsService departmentdynamicsService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    @RequiresPermissions("zy:departmentdynamics:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = departmentdynamicsService.queryPage(params);
        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    @RequiresPermissions("zy:departmentdynamics:info")
    public R info(@PathVariable("id") Integer id){
		DepartmentdynamicsEntity departmentdynamics = departmentdynamicsService.getById(id);

        return R.ok().put("departmentdynamics", departmentdynamics);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    @RequiresPermissions("zy:departmentdynamics:save")
    public R save(@RequestBody DepartmentdynamicsEntity departmentdynamics){
		departmentdynamicsService.save(departmentdynamics);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    @RequiresPermissions("zy:departmentdynamics:update")
    public R update(@RequestBody DepartmentdynamicsEntity departmentdynamics){
		departmentdynamicsService.updateById(departmentdynamics);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    @RequiresPermissions("zy:departmentdynamics:delete")
    public R delete(@RequestBody Integer[] ids){
		departmentdynamicsService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
